package com.baba.bracelet.controller;

import com.baba.bracelet.dto.output.EquipOutDTO;
import com.baba.bracelet.service.EquipService;
import com.baba.bracelet.service.EquipStateService;
import com.baba.entity.UserInfoEntity;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author wulongbo
 * @version 1.0
 * @date 2020/6/13 14:31
 * @description
 */
@RestController
@RequestMapping("/equip")
@Api(tags = "设备信息查询管理模块(至对接web到服务器【http协议】)")
public class EquipController {

    @Autowired
    private EquipService equipService;


    /**
     * 分页查询全部设备数据
     * @Author wulongbo
     * @CreateTime 2020/6/13 16:37
     * @Return IPage<EquipOutDTO> 分页数据
     */
    @ApiOperation(value="查询所有设备的基础信息", notes="查询所有设备的基础信息")
    @ApiImplicitParams({
            @ApiImplicitParam(paramType = "query", name = "current", dataType = "int", required = false, value = "当前页",defaultValue = "1"),
            @ApiImplicitParam(paramType = "query", name = "size", dataType = "int", required = false, value = "每页条数",defaultValue = "5")})
    @RequestMapping("/getEquipListPage")
    public IPage<EquipOutDTO> getEquipListPage(int current,int size){
        //需要在Config配置类中配置分页插件
        IPage<EquipOutDTO> page = new Page<>();
        page.setCurrent(current); //当前页
        page.setSize(size);    //每页条数
        return equipService.selectEquipInfo(page);
    }
}
